import React, { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'

const useAuth=() =>{
 const nav=useNavigate()
 useEffect(()=>{
    const token=localStorage.getItem('token')
    if(!token)nav('/login')
 })
}

export default useAuth
